import { SET_PREFERENCES_SIDEPANELS } from '../../constants/ActionTypes';
import cloneDeep from 'lodash.clonedeep';

const defaultState = {
  'study-browser': {
    pos: 'bottom',
    show: true,
  },
  'visit-view': {
    pos: 'right',
    show: true,
  },
};

const sidePanels = (state = defaultState, action) => {
  switch (action.type) {
    case SET_PREFERENCES_SIDEPANELS: {
      return { ...state, ...cloneDeep(action.state) } ;
    }
    default:
      return state;
  }
};

export { defaultState };

export default sidePanels;
